const mongoose = require('mongoose');
const { ObjectId } = mongoose.Schema;

/**
 * Export model definition object.
 */
module.exports = {
  projectId: ObjectId,
  versionId: ObjectId,
  fileId: ObjectId,
  functionId: { type: ObjectId, unique: true, index: true },
  variables: {
    global: Object,
    params: Object,
    statics: Object,
    local: Object,
  },
  stubs: Object,
  malloc: Object,
  output: Object,
  fixedAddrs: Object,
  objectName: String,
  externalGlobals: [{
    _id: false,
    fullname: String,
    fileId: ObjectId,
  }],
  integratedFuncs: Object,
  // 死循环信息
  infiniteLoops: [{
    _id: false,
    fileId: ObjectId,
    functionId: ObjectId,
    nodeId: Number,
    times: Number, // 用户设置最大执行次数
    filePath: String,
    functionKey: String, // c=函数名; c++=mangledId
  }],
};
